<?php
/**
 * 上传图片控制器
 * Created by qinpeizhou.
 * Date: 2018/5/13
 * Time: 10:59
 * Email : 1031219129@qq.com
 */

class ImageController extends Yaf_Controller_Abstract
{
    public function indexAction(){
        $file_upload_url =dirname(__FILE__).'/../../../../public/static/upload';
        $info = uploadfile($_FILES['file'],$file_upload_url);
        if(is_array($info)) {
            $data = [
                'image' => server_config('host')."/upload/".$info['filename'],
            ];
            show('OK',$data,200);
        }else {
            show('error',[],200);
        }
        return FALSE;
    }
}
